/*
 * ErrorDialog.java
 *
 * Created on September 8, 2005, 10:55 AM
 */
package com.bff.slimserver.musicjukebox.ui.components;

import com.bff.bjj.utils.Resources;
import com.bff.slimserver.musicjukebox.ui.ThumbnailPanel;
import java.awt.Frame;
import java.awt.Dimension;
import org.bff.slimserver.musicobjects.SlimPlayableItem;

/**
 *
 * @author  Bill
 */
public class CoverArtThumbnailDialog extends MusicJDialog {

    private SlimPlayableItem item;
    private ThumbnailPanel tp;

    /** Creates new form ErrorDialog */
    public CoverArtThumbnailDialog(Frame frame, SlimPlayableItem item) {
        super(frame);        
        this.item = item;
      
        tp = new ThumbnailPanel();
        tp.setPreferredSize(new Dimension(500, 500));
        tp.loadImage(item);
        initComponents();

        setHalfScreenSizeCentered();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        btnPanel = new com.bff.bjj.ui.component.BJJPanel();
        btnClose = new com.bff.bjj.ui.component.BJJButton();
        imagePanel = new CoverArtPanel();
        imagePanel.add(tp);

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle(Resources.getMessage(Resources.LABEL_KEY.COVER_ART_TITLE));

        btnPanel.setLayout(new java.awt.GridBagLayout());

        btnClose.setText(Resources.getMessage(Resources.LABEL_KEY.DIALOG_CLOSE));
        btnClose.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCloseActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 5;
        gridBagConstraints.gridy = 1;
        btnPanel.add(btnClose, gridBagConstraints);

        getContentPane().add(btnPanel, java.awt.BorderLayout.SOUTH);

        imagePanel.setBackground(new java.awt.Color(0, 0, 0));
        imagePanel.setPreferredSize(new java.awt.Dimension(750, 500));
        getContentPane().add(imagePanel, java.awt.BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCloseActionPerformed
    this.dispose();
}//GEN-LAST:event_btnCloseActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnClose;
    private javax.swing.JPanel btnPanel;
    private javax.swing.JPanel imagePanel;
    // End of variables declaration//GEN-END:variables

    /**
     * @return the item
     */
    public SlimPlayableItem getItem() {
        return item;
    }

    /**
     * @param item the item to set
     */
    public void setItem(SlimPlayableItem item) {
        this.item = item;
    }
}
